home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4784 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.mindlink.net!news
  2. From: genew@mindlink.bc.ca (Gene Wirchenko)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Fastest way to computer log(base2) of x?
  5. Date: Wed, 07 Feb 1996 00:29:51 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4f8rtu$1ib@fountain.mindlink.net>
  8. References: <4e61iu$p6e@villa.fc.net> <4e72il$dvl@ns.RezoNet.NET> <4f647p$lc5@druid.borland.com> <9602061633.AA15316@dxmint.cern.ch>
  9. NNTP-Posting-Host: line341.nwm.mindlink.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Dan Pop <danpop@mail.cern.ch> wrote:
  13.  
  14. >pete@borland.com (Pete Becker) writes:
  15.  
  16. >>Still faster: use a table with INT_MAX entries and remove all of the 
  17. >>conditionals. Why do the responses here assume that sacrificing speed for 
  18. >>space savings is appropriate? The question asks for the fastest, not something 
  19. >>that's reasonably fast but doesn't use much space.
  20.  
  21. >Initializing a table with 2147483648 entries might take quite a lot of
  22. >time.  That is, assuming that the system is configured with enough virtual
  23. >memory :-)
  24.  
  25. >Dan
  26. >-- 
  27. >Dan Pop
  28. >CERN, CN Division
  29. >Email: danpop@mail.cern.ch 
  30. >Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  31.  
  32.      That's only 2 to the 31st.  You'd need 2 to 32nd.  It also
  33. wouldn't be portable code.  What if another platform uses (say) 64
  34. bits?
  35.  
  36. Sincerely,
  37.  
  38. Gene Wirchenko
  39.  
  40. C Pronunciation Guide:
  41.      y=x++;     "wye equals ex plus plus semicolon"
  42.      x=x++;     "ex equals ex doublecross semicolon"
  43.  
  44.